<!-- 主页内容 -->
<template>
  <div class="main">
    <div class="mask"></div>
    <div class="banner">
      <swiper ref="mySwiper" :options="swiperOptions">
        <swiper-slide v-for="item in bannerimg" :key="item.w_s_loopimg_id"><img :src="item.loop_img" :alt="item.title"></swiper-slide>
        <div class="swiper-pagination" slot="pagination"></div>
      </swiper>
    </div>
  </div>
</template>

<script>
export default {
  computed: {
    swiper() {
      return this.$refs.mySwiper.$swiper;
    },
  },
  mounted() {
    this.$axios.getLoopimg().then((result) => {
      console.log(result.wdata)
      this.bannerimg=result.wdata
    }).catch((err) => {
      console.log(err)
    });
    console.log("Current Swiper instance object", this.swiper);
    this.swiper.slideTo(3, 1000, false);
  },
  data() {
    return {
      bannerimg:[],
      swiperOptions: {
        loop: true,
        autoplay: true,
        pagination: {
          el: ".swiper-pagination",
        },
        // Some Swiper option/callback...
      },
    };
  },
};
</script>
<style lang="less" scoped>
.main {
  .mask {
    height: 0.5rem;
  }
  .banner {
    height: 1.2rem;
    width: 100%;
    background: aqua;
    padding: 0 0.1rem;
    .swiper-container {
      height: 1.2rem;
      .swiper-slide{
        img{
          width: 100%;
          height: 1.2rem
        }
      }
    }
  }
}
</style>
